<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="vue.js"></script>
<body>
    <div id="app">
        <div>
        id: <input type="text" v-model="todoid">
        name: <input type="text" v-model="todoname">
        <input type="button" value="提交" @click="add">         
        </div>
        <div v-for="(item,index) in list" :key="item.id">
            <input type="checkbox">{{item.id}} <span>{{item.name}}</span> 
        </div>
       
    </div>
<script>
    let vm = new Vue({
        el:'#app',
        data:{
            todoid:'',
            todoname:'',
            list:[
                { id:1,name:'窝窝'}

            ]
        },
        methods:{
            add(){
                this.list.unshift({
                    id:this.todoid,
                    name:this.todoname
                })
                this.todoname=''
            }
        }
    })
</script>
</body>
</html>